home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group92c.txt / 000095_icon-group-sender _Fri Nov 20 12:48:54 1992.msg < prev    next >
Internet Message Format  |  1993-01-04  |  1KB

  1. Received: by cheltenham.cs.arizona.edu; Fri, 20 Nov 1992 11:12:02 MST
  2. Date: Fri, 20 Nov 92 12:48:54 EST
  3. From: Paul_Abrahams@MTS.cc.Wayne.edu
  4. To: icon-group@cs.arizona.edu
  5. Message-Id: <530200@MTS.cc.Wayne.edu>
  6. Subject: Scanning a list of items
  7. Status: R
  8. Errors-To: icon-group-errors@cs.arizona.edu
  9.  
  10. The Icon Analyst #15 describes several versions of code to scan and
  11. process a list of items.  The list has the form of a string with markers
  12. between items but without a marker after the last item.  An unattractive
  13. solution is
  14.  
  15. text ||:= marker
  16. text ? {
  17.    while process(tab(find(marker))) do
  18.       =marker
  19.    }
  20. A better solution suggested by the Analyst is
  21.  
  22. text ? {
  23.    while process(tab(find(marker)|0)) do
  24.       =marker | break
  25.    }
  26.  
  27. But here's another alternative, which is what I've usually done:
  28.  
  29. (text || marker) ? {
  30.    while process(tab(find(marker))) do
  31.       =marker
  32.    }
  33.  
  34. As to which of the alternatives is better, de gustibus non est
  35. disputandum.
  36.  
  37. Paul Abrahams
  38.